package square;

import java.math.BigDecimal;


import be.kuleuven.cs.som.annotate.Basic;
import be.kuleuven.cs.som.annotate.Immutable;
import border.Wall;

/**
 * A class of normal squares as special kinds of teleporation squares.
 * 
 * @version 3.0
 * @author 	Inge Gielis <inge.gielis@student.kuleuven.be>
 * @author 	Annelies Ketelslegers <annelies.ketelslegers@student.kuleuven.be>
 */
public class NormalSquare extends TeleportationSquare {
	
	/**
	 * Initialize this new square with given temperature and given humidity
	 * and define the floor that will be attached to this square as slippery or not.
	 * 
	 * @param 	temperature
	 * 			The temperature for this new square.
	 * @param 	humidity
	 * 		  	The humidity for this new square.
	 * @param	slipperyFloor
	 * 			The new slippery state of the floor of this square.
	 * @post  	The new temperature for this new square is equal to
	 * 			the given temperature.
	 * 			| new.getTemperature() == temperature
	 * @post  	The new humidity of this new square is equal to the given humidity.
	 * 			| new.getHumidity() == humidity
	 * @post	The slippery state of the floor of this square is equal to 
	 * 			the given state.
	 * 			| new.getBorder(Direction.FLOOR) == slipperyFloor
	 * @throws 	IllegalArgumentException 
	 * 			The given temperature is not a valid value
	 * 			| ! isValidTemperature(temperature)
	 */
	public NormalSquare(Temperature temperature,BigDecimal humidity, Boolean slipperyFloor) 
		throws IllegalArgumentException{
		super(temperature, humidity);
		new Wall(this,Direction.FLOOR, slipperyFloor);
	}
	
	/**
	 * Initialize this new square with the given temperature and humidity
	 * and define the floor that will be attached to this square as not slippery.
	 * 
	 * @param 	temperature
	 * 			The temperature for this new square.
	 * @param 	humidity
	 * 		  	The humidity for this new square.
	 * @effect 	This new square is initialized with the minimal temperature for all squares 
	 * 			as its initial temperature and zero as its initial humidity and false as the
	 * 			new slippery state for the attached floor.
	 * 			|this(getMinTemperature(),new BigDecimal(0), false)
	 * @throws 	IllegalArgumentException 
	 * 			The given temperature is not a valid value
	 * 			| ! isValidTemperature(temperature)
	 */
	public NormalSquare(Temperature temperature, BigDecimal humidity) throws IllegalArgumentException{
		this(temperature,humidity,false);
	}
	
	/**
	 * Initialize this new square with zero temperature and zero humidity
	 * and define the floor that will be attached to this square as not slippery.
	 * 
	 * @effect 	This new square is initialized with 0 degrees Celcius 
	 * 			as its initial temperature and zero as its initial humidity and false as the
	 * 			new slippery state for the attached floor.
	 * 			|this(new Temperature(0),new BigDecimal(0),false)
	 */
	public NormalSquare(){
		this(new Temperature(0),new BigDecimal(0), false);
	}
	
	
	/**
	 * Return the lower limit of the temperature that applies to all squares.
	 * 		The lower limit of the temperature expresses the lowest possible value
	 * 		for the temperature of a square.
	 */
	@Basic @Immutable
	@Override
	public Temperature getMinTemperature(){
		return MIN_TEMPERATURE;
	}
	
	/**
	 * Return the upper limit for the temperature that applies to all squares.
	 * 		The upper limit of the temperature expresses the highest possible value
	 * 		for the temperature of a square.
	 */
	@Basic @Immutable
	@Override
	public Temperature getMaxTemperature(){
		return MAX_TEMPERATURE;
	}

	/**
	 * Variable registering the upper limit for the temperature that applies to all squares.
	 */
	private static final Temperature MAX_TEMPERATURE = new Temperature(5000,TemperatureScale.CELCIUS);

	/**
	 * Variable registering the lower limit for the temperature that applies to all squares.
	 */
	private final static Temperature MIN_TEMPERATURE = new Temperature(-200,TemperatureScale.CELCIUS);

	/**
	 * Return the maximal amount of doors that a normal square can have.
	 */
	@Override
	public int getMaxNbDoors() {
		return MAX_NB_DOORS;
	}
	
	/**
	 * Variable registering the maximal amount of doors a normal square can have.
	 */
	private final static int MAX_NB_DOORS = 2;
	

	/**
	 * Return the maximal amount of borders that a normal square can have.
	 */
	@Override
	public int getMaxNbBorders() {
		return MAX_NB_BORDERS;
	}
	
	/**
	 * Variable registering the maximal amount of borders a normal square can have.
	 */
	private final static int MAX_NB_BORDERS = 6;

	
}
